import wx

class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
        self.InitUI()
    def InitUI(self):
        toolbar = self.CreateToolBar()
        qtool = toolbar.AddTool(wx.ID_ANY, 'Quit', wx.Bitmap('../icon/texit.png'))
        toolbar.Realize()
        self.Bind(wx.EVT_TOOL, self.OnQuit, qtool)

    def OnQuit(self, e):
        self.Close()
def main():
    app = wx.App()
    frame = Example(None, title='工具栏演示')
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()
